package com.huawei.hms.support.api.sns;

import com.huawei.hms.api.HuaweiApiClient;
import com.huawei.hms.core.aidl.IMessageEntity;
import com.huawei.hms.support.api.PendingResultImpl;
import com.huawei.hms.support.api.client.PendingResult;
import com.huawei.hms.support.api.client.Result;
import com.huawei.hms.support.api.client.Status;
import com.huawei.hms.support.api.entity.sns.SnsMsg;
import com.huawei.hms.support.api.entity.sns.internal.AddFriendReq;
import com.huawei.hms.support.api.entity.sns.internal.AddFriendResp;
import com.huawei.hms.support.api.entity.sns.internal.FriendSelectorIntentReq;
import com.huawei.hms.support.api.entity.sns.internal.GetContactSelectorIntentReq;
import com.huawei.hms.support.api.entity.sns.internal.GetFriendListResp;
import com.huawei.hms.support.api.entity.sns.internal.GetGroupListResp;
import com.huawei.hms.support.api.entity.sns.internal.GetGroupMemListResp;
import com.huawei.hms.support.api.entity.sns.internal.GetIMStatusResp;
import com.huawei.hms.support.api.entity.sns.internal.GetUnreadMsgResp;
import com.huawei.hms.support.api.entity.sns.internal.GetUserUnreadMsgResp;
import com.huawei.hms.support.api.entity.sns.internal.GroupListReq;
import com.huawei.hms.support.api.entity.sns.internal.GroupMemListReq;
import com.huawei.hms.support.api.entity.sns.internal.GroupSelectorIntentReq;
import com.huawei.hms.support.api.entity.sns.internal.SNSIntentResp;
import com.huawei.hms.support.api.entity.sns.internal.SNSVoidEntity;
import com.huawei.hms.support.api.entity.sns.internal.SnsNaming;
import com.huawei.hms.support.api.entity.sns.internal.SnsSendMsgIntentReq;
import com.huawei.hms.support.api.entity.sns.internal.UiIntentReq;
import com.huawei.hms.support.api.entity.sns.internal.UserDataReq;
import com.huawei.hms.support.api.entity.sns.internal.UserDataResp;
import com.huawei.hms.support.api.entity.sns.internal.UserSearchReq;
import com.huawei.hms.support.api.entity.sns.internal.UserSearchResp;
import com.huawei.hms.support.api.entity.sns.internal.UserUnreadMsgReq;
import com.huawei.hms.support.log.HMSLog;

public class HuaweiSnsApiImpl implements HuaweiSnsApi {
    private static PendingResultImpl<FriendListResult, GetFriendListResp> a(HuaweiApiClient huaweiApiClient) {
        return new 1(huaweiApiClient, SnsNaming.getFriendList, new SNSVoidEntity());
    }

    private static PendingResultImpl<GroupListResult, GetGroupListResp> a(HuaweiApiClient huaweiApiClient, GroupListReq groupListReq) {
        return new 8(huaweiApiClient, SnsNaming.getGroupList, groupListReq);
    }

    private static PendingResultImpl<GroupMemListResult, GetGroupMemListResp> a(HuaweiApiClient huaweiApiClient, GroupMemListReq groupMemListReq) {
        return new 9(huaweiApiClient, SnsNaming.getGroupMemList, groupMemListReq);
    }

    private static PendingResultImpl<UserDataResult, UserDataResp> a(HuaweiApiClient huaweiApiClient, UserDataReq userDataReq) {
        return new 10(huaweiApiClient, SnsNaming.getUserData, userDataReq);
    }

    private static PendingResultImpl<UnreadMsgCountResult, GetUnreadMsgResp> a(HuaweiApiClient huaweiApiClient, SNSVoidEntity sNSVoidEntity) {
        return new 11(huaweiApiClient, SnsNaming.getUnreadMsgCount, sNSVoidEntity);
    }

    private static PendingResultImpl<UserUnreadMsgCountResult, GetUserUnreadMsgResp> a(HuaweiApiClient huaweiApiClient, UserUnreadMsgReq userUnreadMsgReq) {
        return new 12(huaweiApiClient, SnsNaming.getUserCount, userUnreadMsgReq);
    }

    private static PendingResultImpl<IntentResult, SNSIntentResp> a(HuaweiApiClient huaweiApiClient, FriendSelectorIntentReq friendSelectorIntentReq) {
        return new 13(huaweiApiClient, SnsNaming.getFriendSelectorIntent, friendSelectorIntentReq);
    }

    private static PendingResultImpl<IntentResult, SNSIntentResp> a(HuaweiApiClient huaweiApiClient, GroupSelectorIntentReq groupSelectorIntentReq) {
        return new 14(huaweiApiClient, SnsNaming.getGroupSelectorIntent, groupSelectorIntentReq);
    }

    private static PendingResultImpl<IntentResult, SNSIntentResp> a(HuaweiApiClient huaweiApiClient, GetContactSelectorIntentReq getContactSelectorIntentReq) {
        return new 15(huaweiApiClient, SnsNaming.getContactSelectorIntent, getContactSelectorIntentReq);
    }

    private static PendingResultImpl<IntentResult, SNSIntentResp> b(HuaweiApiClient huaweiApiClient, SNSVoidEntity sNSVoidEntity) {
        return new 2(huaweiApiClient, SnsNaming.getGroupCreatorIntent, sNSVoidEntity);
    }

    private static PendingResultImpl<IntentResult, SNSIntentResp> a(HuaweiApiClient huaweiApiClient, UiIntentReq uiIntentReq) {
        return new 3(huaweiApiClient, SnsNaming.getUiIntent, uiIntentReq);
    }

    private static PendingResultImpl<IntentResult, SNSIntentResp> a(HuaweiApiClient huaweiApiClient, SnsSendMsgIntentReq snsSendMsgIntentReq) {
        return new PendingResultImpl<IntentResult, SNSIntentResp>(huaweiApiClient, SnsNaming.getMsgSendIntent, snsSendMsgIntentReq) {
            public /* synthetic */ Result onComplete(IMessageEntity iMessageEntity) {
                return a((SNSIntentResp) iMessageEntity);
            }

            public IntentResult a(SNSIntentResp sNSIntentResp) {
                IntentResult intentResult = new IntentResult();
                intentResult.setStatus(Status.SUCCESS);
                intentResult.setIntent(sNSIntentResp.getIntent());
                HMSLog.i("HuaweiSnsApiImpl", "getMsgSendIntent onComplete");
                return intentResult;
            }
        };
    }

    private static PendingResultImpl<AddFriendResult, AddFriendResp> a(HuaweiApiClient huaweiApiClient, AddFriendReq addFriendReq) {
        return new 5(huaweiApiClient, SnsNaming.addFriend, addFriendReq);
    }

    private static PendingResultImpl<UserSearchResult, UserSearchResp> a(HuaweiApiClient huaweiApiClient, UserSearchReq userSearchReq) {
        return new 6(huaweiApiClient, SnsNaming.searchUser, userSearchReq);
    }

    private static PendingResultImpl<IMStatusResult, GetIMStatusResp> b(HuaweiApiClient huaweiApiClient) {
        return new 7(huaweiApiClient, SnsNaming.getIMStatus, new SNSVoidEntity());
    }

    public PendingResult<FriendListResult> getFriendList(HuaweiApiClient huaweiApiClient) {
        HMSLog.i("HuaweiSnsApiImpl", "Enter getFriendList");
        return a(huaweiApiClient);
    }

    public PendingResult<GroupListResult> getGroupList(HuaweiApiClient huaweiApiClient, int i) {
        HMSLog.i("HuaweiSnsApiImpl", "Enter getGroupList");
        GroupListReq groupListReq = new GroupListReq();
        groupListReq.setGroupType(i);
        return a(huaweiApiClient, groupListReq);
    }

    public PendingResult<GroupMemListResult> getGroupMemList(HuaweiApiClient huaweiApiClient, long j) {
        HMSLog.i("HuaweiSnsApiImpl", "Enter getGroupList");
        GroupMemListReq groupMemListReq = new GroupMemListReq();
        groupMemListReq.setGroupId(j);
        return a(huaweiApiClient, groupMemListReq);
    }

    public PendingResult<UserDataResult> getUserData(HuaweiApiClient huaweiApiClient, long j) {
        HMSLog.i("HuaweiSnsApiImpl", "Enter getUserData");
        UserDataReq userDataReq = new UserDataReq();
        userDataReq.setUserId(j);
        return a(huaweiApiClient, userDataReq);
    }

    public PendingResult<UnreadMsgCountResult> getUnreadMsgCount(HuaweiApiClient huaweiApiClient) {
        HMSLog.i("HuaweiSnsApiImpl", "Enter getUnreadMsgCount");
        return a(huaweiApiClient, new SNSVoidEntity());
    }

    public PendingResult<UserUnreadMsgCountResult> getUserCount(HuaweiApiClient huaweiApiClient, long j) {
        HMSLog.i("HuaweiSnsApiImpl", "Enter getUserCount");
        UserUnreadMsgReq userUnreadMsgReq = new UserUnreadMsgReq();
        userUnreadMsgReq.setUserId(j);
        return a(huaweiApiClient, userUnreadMsgReq);
    }

    public PendingResult<IntentResult> getFriendSelectorIntent(HuaweiApiClient huaweiApiClient, boolean z) {
        HMSLog.i("HuaweiSnsApiImpl", "Enter getFriendSelectorIntent");
        FriendSelectorIntentReq friendSelectorIntentReq = new FriendSelectorIntentReq();
        friendSelectorIntentReq.setSingleChoice(z);
        return a(huaweiApiClient, friendSelectorIntentReq);
    }

    public PendingResult<IntentResult> getGroupSelectorIntent(HuaweiApiClient huaweiApiClient, int i) {
        HMSLog.i("HuaweiSnsApiImpl", "Enter getGroupSelectorIntent");
        GroupSelectorIntentReq groupSelectorIntentReq = new GroupSelectorIntentReq();
        groupSelectorIntentReq.setGroupType(i);
        return a(huaweiApiClient, groupSelectorIntentReq);
    }

    public PendingResult<IntentResult> getContactSelectorIntent(HuaweiApiClient huaweiApiClient, boolean z) {
        HMSLog.i("HuaweiSnsApiImpl", "Enter getContactSelectorIntent");
        GetContactSelectorIntentReq getContactSelectorIntentReq = new GetContactSelectorIntentReq();
        getContactSelectorIntentReq.setSingleChoice(z);
        return a(huaweiApiClient, getContactSelectorIntentReq);
    }

    public PendingResult<IntentResult> getGroupCreatorIntent(HuaweiApiClient huaweiApiClient) {
        HMSLog.i("HuaweiSnsApiImpl", "Enter getGroupCreatorIntent");
        return b(huaweiApiClient, new SNSVoidEntity());
    }

    public PendingResult<IntentResult> getUiIntent(HuaweiApiClient huaweiApiClient, int i, long j) {
        HMSLog.i("HuaweiSnsApiImpl", "Enter getUiIntent type:" + i);
        UiIntentReq uiIntentReq = new UiIntentReq();
        uiIntentReq.setType(i);
        uiIntentReq.setParam(j);
        return a(huaweiApiClient, uiIntentReq);
    }

    public PendingResult<IntentResult> getMsgSendIntent(HuaweiApiClient huaweiApiClient, SnsMsg snsMsg, boolean z) {
        HMSLog.i("HuaweiSnsApiImpl", "Enter getMsgSendIntent1");
        SnsSendMsgIntentReq snsSendMsgIntentReq = new SnsSendMsgIntentReq();
        snsSendMsgIntentReq.setSnsMsg(snsMsg);
        snsSendMsgIntentReq.setCallerPackageName(huaweiApiClient.getPackageName());
        snsSendMsgIntentReq.setNeedResult(z);
        return a(huaweiApiClient, snsSendMsgIntentReq);
    }

    public PendingResult<IntentResult> getMsgSendIntent(HuaweiApiClient huaweiApiClient, SnsMsg snsMsg, int i, boolean z) {
        HMSLog.i("HuaweiSnsApiImpl", "Enter getMsgSendIntent2");
        return getMsgSendIntent(huaweiApiClient, snsMsg, z);
    }

    public PendingResult<AddFriendResult> addFriend(HuaweiApiClient huaweiApiClient, long j, String str) {
        HMSLog.i("HuaweiSnsApiImpl", "Enter addFriend");
        AddFriendReq addFriendReq = new AddFriendReq();
        addFriendReq.setUserId(j);
        addFriendReq.setRemark(str);
        return a(huaweiApiClient, addFriendReq);
    }

    public PendingResult<UserSearchResult> searchUser(HuaweiApiClient huaweiApiClient, String str) {
        HMSLog.i("HuaweiSnsApiImpl", "Enter searchUser");
        UserSearchReq userSearchReq = new UserSearchReq();
        userSearchReq.setAccount(str);
        return a(huaweiApiClient, userSearchReq);
    }

    public PendingResult<IMStatusResult> getIMStatus(HuaweiApiClient huaweiApiClient) {
        HMSLog.i("HuaweiSnsApiImpl", "Enter getIMStatus");
        return b(huaweiApiClient);
    }
}
